﻿using RabbitMQ.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiTu.QueueService.Providers
{
    public static class RabbitMQFactory
    {
        public static IModel CreateRabbitMQChannel()
        {
            ConnectionFactory rmqConnFactory = new ConnectionFactory()
            {
                HostName = QueueConfiguration.RabbitMQConfigInfo.Server,
                UserName = QueueConfiguration.RabbitMQConfigInfo.User,
                Password = QueueConfiguration.RabbitMQConfigInfo.Password,
                Port = QueueConfiguration.RabbitMQConfigInfo.Port,
            };
            IConnection conn = rmqConnFactory.CreateConnection();
            return conn.CreateModel();
        }
    }
}
